package ren.renshuaipeng.util.ajax;

/**
 * ClassName: AjaxDto<br/>
 * Function: Ajax相应结果. <br/>
 * {"errcode":0,"errmsg":"ok"}
 * Date:     2015/12/16 16:08<br/>
 *
 * @author 任帅鹏（作者）
 * @version V1.00 （版本号）
 * @see
 * @since JDK 1.8
 */
public class AjaxDto {

    private static final String SUCCESS_CODE="0";
    public static final String VALIDATE_CODE="1";
    public static final String SQL_CODE="2";//数据库异常
    public static final String TOKEN_CODE="3";//重复提交异常

    public AjaxDto(){
        this.errorCode=SUCCESS_CODE;
        this.errorMsg="success";
    }

    /**
     * 成功 描述
     * @param errorMsg
     */
    public AjaxDto(String errorMsg){
        this.errorCode=SUCCESS_CODE;
        this.errorMsg=errorMsg;
    }

    /**
     * 自定义显示
     * @param errorCode
     * @param errorMsg
     */
    public AjaxDto(String errorCode,String errorMsg){
        this.errorCode=errorCode;
        this.errorMsg=errorMsg;
    }
    
    /**
     * 自定显示消息，附加额外信息
     * @param errorCode
     * @param errorMsg
     * @param data
     */
    public AjaxDto(String errorCode,String errorMsg,Object data){
        this.errorCode=errorCode;
        this.errorMsg=errorMsg;
        this.data=data;
    }

    private String errorCode;
    private String errorMsg;
    private Object data;

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

	/**
	 * @return the data
	 */
	public Object getData() {
		return data;
	}

	/**
	 * @param data the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}
    
    
}
